<!--{template admin/header}-->
<script type="text/javascript">
	var textCounter=function (field,counter,maxlimit){
		var charcnt = field.value.length;
		if (charcnt > maxlimit) {
			field.value = field.value.substring(0, maxlimit);
		}else {
			document.getElementById(counter).innerHTML=charcnt;
		}
	}
</script>
<script src="templates/default/js/date/WdatePicker.js" type="text/javascript"></script>
<form action="admin.php?mod=vote&code=doedit" method="post" enctype="multipart/form-data" name="form1" id="form1" onsubmit="mk_date();">
  <table cellspacing="1" cellpadding="4" width="100%" align="center" class="tableborder">
    <tr class="header">
      <td colspan="2">编辑投票</td>
    </tr>
    <tr>
      <td width="13%" align="center" bgcolor="#F8F8F8">投票主题：</td>
      <td bgcolor="#FFFFFF">
	  	<span style="margin-right:15px;"><input type="text" name="subject" id="subject" value="{$vote['subject']}" size="40"/></span>
		<span><input class="checkbox" type="checkbox" name="recd" value="1" {$checked['recd']}>推荐</span>
	  </td>
    </tr>
    <tr>
      <td width="13%" align="center" bgcolor="#F8F8F8">投票说明:</td>
      <td bgcolor="#FFFFFF">
	  <textarea name="message" id="maxcharfield" style="width:480px; height:80px;" > {$vote['message']}</textarea></td>
    </tr>
	<tr>
      <td width="13%" align="center" bgcolor="#F8F8F8">投票项</td>
      <td bgcolor="#FFFFFF">
	  	<!--{loop $range $val}-->
		<!--{if isset($options[$val])}-->
			<input type="text" name="old_option[{$options[$val]['oid']}]"  size="40" value="$options[$val]['option']"/>
			<br />
		<!--{else}-->
	  		<input type="text" name="option[]"  size="40" value=""/>
			<br />
		<!--{/if}-->
		<!--{/loop}-->
	  </td>
    </tr>
	<tr>
      <td width="13%" align="center" bgcolor="#F8F8F8">单选/多选：</td>
      <td bgcolor="#FFFFFF">
		<select name="maxchoice" id="maxchoice">
			<option value="1">
				单选
			</option>
			<!--{loop $range $val}-->
				<!--{eval $i=$val+1;}-->
				<!--{if $i!=1}-->
				<option value="{$i}" {$selected[$i]}>最多可选{$i}项</option>
				<!--{/if}-->
			<!--{/loop}-->
		</select>
	  </td>
    </tr>
	<tr>
      <td width="13%" align="center" bgcolor="#F8F8F8">投票结果：</td>
      <td bgcolor="#FFFFFF">
	  	<input type="radio" id='is_view_1' name="is_view"   value="1" checked class="vt_radio1" {$checked['is_view'][1]}/><label for="is_view_1">任何人可见</label>
		<input type="radio"  id="is_view_2" name="is_view"  value="0"  class="vt_radio1"  {$checked['is_view'][0]} /><label for="is_view_2">投票后可见</label>
	  </td>
    </tr>
	<tr>
      <td width="13%" align="center" bgcolor="#F8F8F8">截止时间：</td>
      <td bgcolor="#FFFFFF">
	  		<input id="expiration" name="expiration" value="{$date}" onclick="WdatePicker({minDate:'%y-%M-%d'})"  type="text" readonly="readonly">
			&nbsp;&nbsp;
			{$hour_select}&nbsp;时&nbsp;&nbsp;{$min_select}&nbsp;分
	  </td>
    </tr>
    <tr>
      <td align="center" bgcolor="#F8F8F8">&nbsp;</td>
      <td bgcolor="#FFFFFF">
	  	<input type="submit" class="button" name="groupsubmit" value="提 交" />&nbsp;
		<input name="reset" type="reset"class="button" onClick="history.go(-1)" value="取 消" />
		<input name="vid" type="hidden" id="vid" value="{$vid}">
	</td>
    </tr>
  </table>
  
  <script language="javascript">
  	//提交前对时间处理下
	function mk_date()
	{
		var h = document.getElementById('hour').value;
		var m = document.getElementById('min').value;
		var time = h+":"+m;
		var expiration = document.getElementById('expiration').value;
		document.getElementById('expiration').value = expiration+" "+time;
	}
  </script>

</form>
